#include "../plot/widget.h"
#include "../plot/PlotView.h"
#include <QHBoxLayout>
#include "../plot/plotmodel.h"
Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::WidgetClass())
{
    ui->setupUi(this);
    auto view = new PlotView(this);
    auto layout = new QHBoxLayout(this);
    layout->addWidget(view);
    auto model = view->_tableView->getModel();
    for (size_t i = 1; i < 5; i++)
{
    QSharedPointer<QCPGraphDataContainer> data(new QCPGraphDataContainer);
    for (int j = 0; j < 100; j++)
    {
        data->add(QCPGraphData(j, 20*i * cos((i * 5 + j) / 30.0 * 3.14)));
    }
    view->_tableView->getModel()->add_plotData(data, "name" + QString::number(i));
   // _rootItems.addData(PlotData(data, QColor((Qt::GlobalColor)(i + Qt::red)), "name" + QString::number(i), "unit" + QString::number(i), this));
}
    
}
Widget::~Widget()
{
    delete ui;
}
